package com.ase.leetcode;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;

/**
 * @author gyhstart
 * @create 2021/3/11 - 11:24
 **/
public class test {
    public static void main(String[] args) {
//        test1();
        test2();
    }

    public static void test1() {
        //创建一个带泛型的Optional容器类
        Optional<Employee> op = Optional.of(new Employee());
        Employee emp = op.get();
        System.out.println(emp);
    }

    public static void test2() {
        Optional<Employee> op = Optional.empty();//empty()方法只是构建一个空的Optional，里面没有任何的东西
        System.out.println(op.get());

        //创建list
        List<String> list = Arrays.asList("123","456");
        //输出list里面的每个内容
        list.forEach(System.out::println);


    }
}
